﻿using System.IO;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace ClassifiedAds.Infrastructure.Storages.Fake;

public class FakeStorageManager : IFileStorageManager
{
    public Task CreateAsync(IFileEntry fileEntry, Stream stream, CancellationToken cancellationToken = default)
    {
        fileEntry.FileLocation = "Fake.txt";
        return Task.CompletedTask;
    }

    public Task DeleteAsync(IFileEntry fileEntry, CancellationToken cancellationToken = default)
    {
        return Task.CompletedTask;
    }

    public Task<byte[]> ReadAsync(IFileEntry fileEntry, CancellationToken cancellationToken = default)
    {
        return Task.FromResult(Encoding.UTF8.GetBytes("The content is generated by Fake Storage Manager."));
    }

    public Task ArchiveAsync(IFileEntry fileEntry, CancellationToken cancellationToken = default)
    {
        return Task.CompletedTask;
    }

    public Task UnArchiveAsync(IFileEntry fileEntry, CancellationToken cancellationToken = default)
    {
        return Task.CompletedTask;
    }
}
